//
//  ViewController.swift
//  button_demo1
//
//  Created by 李煜 on 2023/4/4.
//

import UIKit

class ViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()




    let button = UIButton(frame:CGRect(x:10, y:150, width:100, height:30))
    // 设置title
    button.setTitle("普通情况", for: .normal)
    button.setTitle("按住状态", for: .selected)
    button.setTitle("禁用状态", for: .disabled)
    // 按钮文字颜色的设置
    button.setTitleColor(.red, for: .normal)
    button.setTitleColor(.blue, for: .selected)
    button.setTitleColor(.gray, for: .disabled)

    button.backgroundColor = UIColor(red: 1, green: 1, blue: 0.5, alpha: 0.4)
//    button.isEnabled = false
    view.addSubview(button)

  }


}

